package com.cj.http;

import com.cj.models.ResultModel;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;

@RestController
public class ErrorHandler implements ErrorController {
    @RequestMapping("/error")
    public ResultModel error(HttpServletResponse rsp){
        return new ResultModel("error","http code:"+rsp.getStatus());
    }

    @Override
    public String getErrorPath() {
        return "/error";
    }
}
